Author: Riyaz Panjwani

EXPLANATION

In this assignment, we will implement a few different techniques that require you to manipulate images on the manifold of natural images. First, we will invert a pre-trained generator to find a latent variable that closely reconstructs the given real image. In the second part of the assignment, we will take a hand-drawn sketch and generate an image that fits the sketch accordingly.

We will be using a pre-trained network for doing so, we will be working with vanilla GAN and style gan with latent space of z, w, and w+ as mentioned in the Image2Style++ paper.

Figure 0: Results after interpolation of cats

Part 1: Inverting the Generator

We implemented content-space loss and optimize a random noise with respect to the content loss only. The content loss between two images can be provided as below:

Figure 1: Content Image Loss

We choose to consider the output manifold of a trained generator as close to the natural image manifold. So, we can set up the following nonconvex optimization problem as below:

Figure 2: Non-convex optimization problem

As this is a nonconvex optimization problem where we can access gradients, we can attempt to solve it with any first-order or quasi-Newton optimization method (e.g., LBFGS). One issue here is that these optimizations can be both unstable and slow. We try running the optimization from many random seeds and taking a stable solution with the lowest loss as your final output.

Results

Part 2: Interpolate your Cats

Here we use a convex combination of inverses to interpolate between images. We experiment with different generative models and different latent spaces (latent code z, w space, and w+ space).

Results

Style GAN in Z space

Style GAN in W space

Style GAN in W+ space

Part 3: Scribble to Image

Next, we would like to constrain our image in some way while having it look realistic. This constraint could be color scribble constraints as we initially tackle this problem, but could be many other things as well. We will initially develop this method in general and then talk about color scribble constraints in particular. To generate an image subject to constraints, we solve a penalized nonconvex optimization problem. We’ll assume the constraints are of the form:

Figure 8: Image constraints

Written in a form that includes our trained generator G, this soft-constrained optimization problem is

Results

Style GAN in W Space

Style GAN in W+ Space

BELLS & WHISTLES

Working with High-Resolution Images

Working with High-Resolution Interpolation

CREDITS

https://arxiv.org/pdf/1609.03552.pdf

https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=1467360

https://arxiv.org/pdf/1609.03552.pdf

https://arxiv.org/abs/1609.07093

https://arxiv.org/abs/1904.03189

https://arxiv.org/abs/1912.04958

https://arxiv.org/abs/2101.05278

https://learning-image-synthesis.github.io/sp22/assignments/hw5